
/* 

Paper: Gentrification and pioneer businesses 
Authors: Behrens, Boulam, Martin, Mayneris 

Name dofile: figure1.do  
Version: 10 nov. 2021 

Output: graph of figure 1 describing the distribution of establishments across floors for pioneers vs non-pioneers 

Inputs:

 - pioneers_final_negbin.dta [produced in identify_pioneers_negbin.do] [publicly available]
 - Manhattan_DandB_Establishments [confidential data from Dunn & Bradstreet -- see readme for access]

*/ 

set scheme s1mono

use Manhattan_DandB_Establishments.dta , clear
replace DB_Floornum = 1000 if DB_Floornum==-1
merge m:1 naics using pioneers_final_negbin
keep if _m==3 
egen estab_all=count(lat_imp), by(pioneer_high_negbin)
drop if  DB_Floornum==.
egen estab=count(lat_imp), by(pioneer_high_negbin) 
collapse (count) nb_estab=lat_imp (mean) estab estab_all, by(pioneer_high_negbin DB_Floornum) 
replace nb_estab=nb_estab/estab
g mis=estab/estab_all

reshape wide nb_estab estab estab_all mis, i(DB_Floornum) j(pioneer_high) 
replace DB_Floornum = -1 if DB_Floornum ==1000

twoway (bar nb_estab0 DB_Floornum if DB_Floornum<50 , lcolor(gs13) fcolor(gs13)) (bar nb_estab1 DB_Floornum if DB_Floornum<50,  fcolor(none) lcolor(black)), legend(off) xtitle("Share of establishements by floor (-1 to 50). Pioneers are in black.")
graph export "bar_floor_pioneer_allblocks.pdf", replace